//2 2 3
// 输出一个数字序列, 然后进行汇总, 最后得出ans
const readline = require("readline");
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});
let initArr = [];
rl.on("line", (line)=>{
    if(initArr.length === 0) {
        initArr =  line.trim().split(" ").map(Number)
        console.log(getResult(initArr))

        // clear
        initArr.length = 0
    }

})

function getResult(initArr) {
    let obj = {}
    for (const num of initArr) {
        if(!obj[num]) {
            obj[num] = 1
        } else {
            obj[num]++
        }
    }
    let ans = 0
    for (let key of Object.keys(obj)) {
        let value = obj[key]
        key = Number(key) + 1
        ans += Math.ceil(value/key) * key
    }

    return ans
}